package com.wzdigit.wms.basic.enums.task;
/*
 * @Author:yangwenbiao
 * @Date 2020/7/30 5:46 PM
 * @version 1.0
 */


import com.wzdigit.wms.basic.enums.BaseEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 任务类型枚举
 */
public enum TaskTypeEnum implements BaseEnum {

	/**
	 * 任务类型
	 */
	TASK_TYPE_PICKTASK(101, "生成拣货任务", "任务类型"), 
	TASK_TYPE_GDNTASK(102, "发货单调度任务", "任务类型");

	/**
	 * 枚举值
	 */
	public int code;

	/**
	 * 枚举名称
	 */
	public String enumName;

	/**
	 * 枚举实体类属性描述
	 *
	 * @return
	 */
	public String description;

	TaskTypeEnum(int code, String enumName) {
		this.code = code;
		this.enumName = enumName;
	}

	TaskTypeEnum(int code, String enumName, String description) {
		this.code = code;
		this.enumName = enumName;
		this.description = description;
	}

	public int getCode() {
		return code;
	}

	public final String getEnumName() {
		return enumName;
	}

	public String getDescription() {
		return description;
	}

	public static TaskTypeEnum getEnumByCode(int enumCode) {
		TaskTypeEnum[] values = TaskTypeEnum.values();
		TaskTypeEnum repairEnum = null;

		for (TaskTypeEnum value : values) {
			if (value.getCode() == enumCode) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}

	public static TaskTypeEnum getEnumByName(String enumName) {
		TaskTypeEnum[] values = TaskTypeEnum.values();
		TaskTypeEnum repairEnum = null;

		for (TaskTypeEnum value : values) {
			if (value.getEnumName().equals(enumName)) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}
	
	public static Map<Integer, String> getEnumByDescription() {
		Map<Integer, String> enumMap = new HashMap<Integer, String>();
		TaskTypeEnum[] values = TaskTypeEnum.values();
		for (TaskTypeEnum value : values) {
			enumMap.put(value.getCode(), value.getEnumName());
		}
		return enumMap;
	}
}
